package com.portal.domain;

import java.util.Date;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import com.portal.base.annotation.Column;
import com.portal.base.annotation.Table;
import com.portal.base.entity.BaseEntity;

/**
 * @Title:内容类
 * @Copyright: Copyright (c) 0.1
 * @author:鲁根成
 * @version: 1.0
 * @time: 2011-4-7
 * 
 */
@Table("sys_content")
public class SysContent extends BaseEntity {
	private String title;
	private String code;// code=1 公司简介 3发展历史 4专业荣誉
	private String describe;
	private String content;
	private Date createDate;
	private int readCount;
	private String thumbnails;
	@Column(name = "reject")
	private String dateString;
	@Column(name = "reject")
	private String  codeString;
	public String getDateString() {
		return dateString;
	}

	public void setDateString(String dateString) {
		this.dateString = dateString;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getDescribe() {
		return describe;
	}

	public void setDescribe(String describe) {
		this.describe = describe;
	}

	public String getContent() {
		return content;
	}
	
	public String getShortContent(){
		Pattern p = Pattern.compile("<img([^(><)]*)>");
		Matcher m = p.matcher(this.content);
		if (m.find() == true) {
			content = m.replaceAll("");
		}
		return null == content?content:content.length()>50?content.substring(0,50):content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	public int getReadCount() {
		return readCount;
	}

	public void setReadCount(int readCount) {
		this.readCount = readCount;
	}

	public String getThumbnails() {
		return thumbnails;
	}

	public void setThumbnails(String thumbnails) {
		this.thumbnails = thumbnails;
	}

	public String getCodeString() {
		return codeString;
	}

	public void setCodeString(String codeString) {
		this.codeString = codeString;
	}
	
	public static void main(String[] args) {
		String content = "<sfsadfsdf>sdfsdf</sfdsdfsdf><img  alt'啊' /><>dsfssadf<>sdf";
		Pattern p = Pattern.compile("<img([^(><)]*)>");
		Matcher m = p.matcher(content);
		if (m.find() == true) {
			System.out.println("sf");
			content = m.replaceAll("");
		}
		System.out.println(content);
	}
}
